package com.gitee.wsl.mathematics.interpolator.ext

import com.gitee.wsl.ext.number.convertRange
import com.gitee.wsl.mathematics.interpolator.Ratio

fun Ratio.convertToRange(min: Float, max: Float): Float = this.toFloat().convertRange(0f, 1f, min, max)
fun Ratio.convertToRange(min: Double, max: Double): Double = this.toDouble().convertRange(0.0, 1.0, min, max)
fun Ratio.convertToRange(min: Ratio, max: Ratio): Ratio = Ratio(this.toDouble().convertRange(0.0, 1.0, min.toDouble(), max.toDouble()))

fun Ratio.convertRange(srcMin: Ratio, srcMax: Ratio, dstMin: Ratio, dstMax: Ratio): Ratio = Ratio(this.toDouble().convertRange(srcMin.toDouble(), srcMax.toDouble(), dstMin.toDouble(), dstMax.toDouble()))
